package org.feng.feign;

import org.feng.base.entity.Result;
import org.feng.entity.User;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @author 冯帅
 * @des TODO
 * @date 2022/2/7 9:07
 * @email 15612509687@163.com
 */
@FeignClient(value = "system", fallback  = UserFallBackHandler.class ,contextId="user")
public interface UserFeign {

    String GET_USER_BY_USER_NAME = "get_user_by_user_name";

    String GET_USER_BY_ID = "get_user_by_id";

    /**
     * 根据用户名获取用户信息
     * @param username 用户名
     * @return
     */
    @GetMapping(GET_USER_BY_USER_NAME)
    Result<User> getUserByUserName(@RequestParam("username") String username);

    /**
     * 根据用户id获取用户信息
     * @param id 用户id
     * @return
     */
    @GetMapping(GET_USER_BY_ID)
    Result<User> getById(@RequestParam("id") Long id);
}
